package com.eureka.bclass.util;

import com.alibaba.fastjson.JSONObject;

import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.stream.Collectors;

/**
 * @Description:
 * @Author: lixing
 * @Date: 2021/6/9 8:59
 */
public class DemoUtil {
    public static void main(String[] args) {
//        Random random = new java.util.Random();
//        // 返回0 to x的一个随机数但不会取到x，即返回[0,x)闭开区间的值。
//        for (int i = 0; i < 100; i++) {
//            int rn = random.nextInt(100);
//            System.out.println(rn);
//        }

//        String url = "2021/06/21/74a7402410de44db875b0bda993d5fbb.mp4";
//        url = url.replace(url.substring(url.indexOf(".")+1), "png");
//        System.out.println(url);

//        int random = new Random().nextInt(10);
//        System.out.println(random);

//        for (int i = 0 ; i < 10; i++) {
//            int j =  new Random().nextInt(10 - 5) + 5 + 1;
//            System.out.println(j);
//        }

//        int size = 2; // 0,1
//        for (int i = 0 ; i < 100; i++) {
//            int random = new Random().nextInt(size);
//            if (random > 1) {
//                System.out.println(random);
//            }
//        }

//        String item = "https://etiger.oss-cn-hangzhou.aliyuncs.com/cbe26bdae02f4bf6ba4a066cea3cbe66.pdf";
//        item = item.replace(item = "https://etiger.oss-cn-hangzhou.aliyuncs.com", "").substring(1);
//        System.out.println(item);

//        List<String> keys = new ArrayList<>();
//        keys.add("2021/07/30/8407077544754f86b919dfb53fe75346.pdf");
//        keys.add("2021/07/30/3d09ae018d38401cb91155f33d274f65.png");
//        keys = keys.stream().map(item -> {
//            item = item.replace("2021", "").substring(1);
//            return item;
//        }).collect(Collectors.toList());
//        System.out.println(JSONObject.toJSONString(keys));

        String nickName = "18013896707";
        nickName = nickName.replace(nickName.substring(3,7), "****");
        System.out.println(nickName);
    }
}
